<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>添加疫苗记录</title>
		<meta name="description" content="">
		<meta name="keywords" content="">
		<meta name="renderer" content="webkit">
		<!-- 设置缩放 -->
		<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
		<!-- 可隐藏地址栏，仅针对IOS的Safari（注：IOS7.0版本以后，safari上已看不到效果） -->
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<!-- 仅针对IOS的Safari顶端状态条的样式（可选default/black/black-translucent ） -->
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<!-- IOS中禁用将数字识别为电话号码/忽略Android平台中对邮箱地址的识别 -->
		<meta name="format-detection" content="telephone=no, email=no" />
		<!-- 启用360浏览器的极速模式(webkit) -->
		<meta name="renderer" content="webkit">
		<!-- 避免IE使用兼容模式 -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<!-- 针对手持设备优化，主要是针对一些老的不识别viewport的浏览器，比如黑莓 -->
		<meta name="HandheldFriendly" content="true">
		<!-- 微软的老式浏览器 -->
		<meta name="MobileOptimized" content="320">
		<!-- uc强制竖屏 -->
		<meta name="screen-orientation" content="portrait">
		<!-- QQ强制竖屏 -->
		<meta name="x5-orientation" content="portrait">
		<!-- UC强制全屏 -->
		<meta name="full-screen" content="yes">
		<!-- QQ强制全屏 -->
		<meta name="x5-fullscreen" content="true">
		<!-- UC应用模式 -->
		<meta name="browsermode" content="application">
		<!-- QQ应用模式 -->
		<meta name="x5-page-mode" content="app">
		<!-- windows phone 点击无高光 -->
		<meta name="msapplication-tap-highlight" content="no">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<link rel="icon" type="image/png" href="../assets/i/favicon.png">
		<link rel="stylesheet" href="../assets/choice/iosSelect.css">
		<link rel="stylesheet" href="../assets/css/LArea.css">
		<link rel="stylesheet" href="../assets/css/amazeui.css" />
		<link rel="stylesheet" href="../assets/css/beans.css" />
		<style>
			.am-list-news-default .am-list-item-hd {
			    white-space: nowrap;
			    text-overflow: ellipsis;
			    overflow: hidden;
			    width: 78%;
			}
		.content{
			overflow: hidden;
			font-size: 14px
		}
			.vaccine-tab{
				margin:0.8rem;
				background-color: #fff;
				border-radius: 5px;
				padding: 0.8rem;
				display: flex;
				display: -webkit-flex;
			}
			.vaccineList{
				width: 77%;
			}
			.vaccineList ul{
				margin-left: 3rem
			}
			.vaccineList ul li{
				height: 2.8rem;
				line-height: 2.8rem;
				border-bottom: 1px solid #f3f3f3
			}
			.title-tab{
				width: 100%;
				height: 3rem;
				line-height: 3rem;
				font-size: 16px;
				background-color: #f3f3f3;
				padding: 0 0.8rem;
				margin: 0.8rem 0
			}
			.am-navbar{
				height: 4rem;
				display: flex;
				display: -webkit-flex;
				align-items: center;
				-webkit-align-items: center;
				position: fixed;
				bottom: 0;
				padding: 0;
				margin: 0
			}
			.am-navbar button{
				margin: 0 1.5rem;
				width: 100%;
				height: 4rem;
				border: none;
				background-color: #fd9185;
				font-size: 1.8rem;
				color: #fff;
				z-index: 9999;
				border-radius: 4px
			}
			#headimgurl{
				display: flex;
				display: -webkit-flex;
				justify-content: center;
				-webkit-justify-content: center;
				flex-direction: column;
				-webkit-flex-direction: column;
				align-items: center;
				-webkit-align-items: center;
				margin: 1.25rem auto;
				background-color: #fff;
				padding: 1rem 0 2rem;
			}
			.headImg,.headImg img{
				display: block;
				width: 5rem;
				height: 5rem;
				border-radius: 50%;
				overflow: hidden;
			}
		</style>
	</head>
	<body>
		<header data-am-widget="header" class="am-header am-header-default bg-48CFAE">
			<div class="am-header-left am-header-nav text-black padding-left05" id="goBackDivs">
				<a  href="javascript:history.go(-1)" class="text-black" id="goBackIcon">
				  	<i class="am-align-left am-margin-0 am-icon-angle-left am-icon-md text-black co-fff"></i>
				  </a> 
			</div>
			<h1 class="am-header-title teblack">
				<a href="#title-link" class="co-fff">添加疫苗记录</a>
			</h1>
		</header>
		<div>
			<div id='headimgurl'>
				<div class='headerdivs'>
					<div class="headImg">
						<img src='../img/childrenForm-headImg.png' id="childHeadImg" />
					</div>
				</div>
				<div class='userName1'><p id="childName">宝宝名称</p></div>
						</div>
			<div style="background-color: white;" class="am-margin-top-sm">
				<div data-am-widget="list_news" class="am-list-news am-list-news-default am-margin-top-sm" style="margin-top: 0;">
				  	<!--列表标题-->
				  	<div class="am-list-news-bd">
				  		<ul class="am-list am-margin-bottom-sm">
							<li class="am-g am-list-item-dated">
				          		<a href="##" class="am-list-item-hd namethe" onclick="return false" style="margin-left: 0.5rem;" >
				          			<span>疫苗列表：</span>    
				          			<input id="vaccineList" placeholder="选择接种疫苗" readonly/>
           	 						<input id="value2" type="hidden"/>
				          		</a>
							</li>
							<li class="am-g am-list-item-dated">
				          		<a href="##" class="am-list-item-hd namethe" onclick="return false" style="margin-left: 0.5rem;" >
				          			<span>选择剂次：</span>    
				          			<input id="jcList" placeholder="选择剂次" readonly/>
           	 						<input id="value2" type="hidden"/>
				          		</a>
							</li>
							<li class="am-g am-list-item-dated">
				          		<a href="##" class="am-list-item-hd namethe" onclick="return false" style="margin-left: 0.5rem;">
				          			<span>接种日期：</span> 
				          			<input required readonly type="text" id="vaccineDate" value="" placeholder="接种日期" style="background-color: white;">
				          		</a>
							</li>
							<li class="am-g am-list-item-dated">
				          		<a href="##" class="am-list-item-hd namethe" onclick="return false" style="margin-left: 0.5rem;" >
				          			<span>接种地区：</span>      
				          			<input id="address" placeholder="选择接种所在地" readonly/>
           	 						<input id="addressHide" type="hidden" />
				          		</a>
							</li>
							<li class="am-g am-list-item-dated">
				          		<a href="##" class="am-list-item-hd namethe" onclick="return false" style="margin-left: 0.5rem;">
				          			<span>接种单位：</span> 
				          			<input placeholder="选择接种点" id="place" readonly/>
				          		</a>
							</li>
				      	</ul>
				  	</div>
				</div>
			</div>
		</div>
		<div class="am-modal am-modal-alert" tabindex="-1" id="ceng">
		  	<div class="am-modal-dialog" style="border-radius: 10px;">
		    	<div class="am-modal-bd" id="info-text">添加成功</div>
		    </div>
	  </div> 
		<div data-am-widget="navbar" class="am-navbar am-cf" id="mendb" >
			<button>添加</button>
	  </div>
		<div class="am-modal am-modal-loading am-modal-no-btn radius4" tabindex="-1" id="my-modal-loading" data-am-modal="{closeViaDimmer: 0}">
			  <div class="am-modal-dialog" style="border-radius: 4px;">
			    	<div class="am-modal-hd">加载中...</div>
				    <div class="am-modal-bd">
				      <span class="am-icon-spinner am-icon-spin"></span>
				    </div>
			  </div>
		</div>
		<script src="../assets/js/jquery.min.js"></script>
		<script src="../assets/js/jquery.cookie.js"></script>
		<script src="../assets/js/amazeui.min.js"></script>
		<script src="../assets/js/fastclick.min.js"></script>
		<script src="../assets/js/jquery.yomi.js"></script>
		<script src="../assets/choice/iosSelect.js"></script>
		<script src="../assets/js/datePicker.js"></script>
		<script src="../js/ym.js"></script>
		<script src="../assets/js/LAreaData2.js"></script>
    	<script src="../assets/js/LArea.js"></script>
		<script src="../js/public.js"></script>
		<script src="../js/data.js"></script>
		
		<script>
            var place=[];
			$(function(){
				var childId = ym.getQueryStringByName('childId');
				var vaccines = document.querySelector('#vaccineList');
				var jcList=document.querySelector('#jcList');
				var jc=[];
			    var list = [];
			    var mydata = new Date();
				var years = mydata.getFullYear();
				var months = mydata.getMonth()+1;
				var days = mydata.getDate();
<<<<<<< .mine

||||||| .r28564
				var place=[];
=======
>>>>>>> .r28612
				var time = years +"-"+months+"-"+days;
				var theSelectData="";
				var charector="";

				var jzAddr="";
				var agent="";
				var childData=JSON.parse(sessionStorage.getItem('curChild'));
				var vaccineId="";
				// $('#childHeadImg').attr('src',childData.childHeadimgurl);
				// $('#childName').html(childData.childRealname);
				/*接种日期*/
				var calendar = new datePicker();
				calendar.init({
					'trigger': '#vaccineDate', /*按钮选择器，用于触发弹出插件*/
					'type': 'date',/*模式：date日期；datetime日期时间；time时间；ym年月；*/
					'minDate':'1995-1-1',/*最小日期*/
					'maxDate':time,/*最大日期*/
					'onSubmit':function(){/*确认时触发事件*/
						theSelectData=calendar.value;
					},
					'onClose':function(){/*取消时触发事件*/
					}
				});
				/*查询疫苗*/
				var ageText=$('#chooseAge').find("option:selected").text();
				function getList(val){
					 ym.ajax({
			            url: "/vaccine/queryVaccineType",
			            param:{
			            	pageNum:1,
							pageSize:10000

			            },
			            success: function (data) {
			            	console.log(data);
			               if(data.obj.results.leng!==0){
			               	for (var j = data.obj.results.length - 1; j >= 0; j--) {
							    list.push({'id': data.obj.results[j].vaccineTypeId, 'value': data.obj.results[j].vaccineTypeName});
			               }
			               }else{
			               	 
			               }
			            }
			        });
				}
				getList(ageText);
				$('#chooseAge').click(function(){
					ageText=$('#chooseAge').find("option:selected").text();
					getList(ageText);
				})
				vaccines.addEventListener('click', function () {
							    var bankSelect = new IosSelect(1, 
							            [list],
							            {
							                container: '.container',
							                title: '接种疫苗',
							                callback: function (selectOneObj) {
							                    $("#vaccineList").val(selectOneObj.value);
							                    charector=selectOneObj.value;
							                    vaccineId=selectOneObj.id;
							                    /*查询剂次*/
							                    ym.ajax({
									            url: "/vaccine/queryAgentByVaccineTypeId",
									            param:{
									            	childId:childData.childId,
									            	vaccineTypeId:selectOneObj.id
									            },
									            success: function (data) {
									            	if(data.obj){
									            		jc=[];
									            		for (var i = 0; i < data.obj.length; i++) {
									            			jc.push({'id': data.obj[i].agent, 'value': data.obj[i].age+"-"+data.obj[i].agent+"剂次"})
									            		}
									            		
									            	}
									            }
									        });
							                },
							                fallback: function () {
							                    console.log(1);
							                },
							                maskCallback: function () {
							                    console.log(2);
							                }
							        });
							    });
				jcList.addEventListener('click', function () {
					var bankSelect = new IosSelect(1, 
						[jc],
						{
							container: '.container',
							title: '选择剂次',
							callback: function (selectOneObj) {
								$("#jcList").val(selectOneObj.value);
								charector=selectOneObj.value;
								agent=selectOneObj.id;
									},
							fallback: function () {
								console.log(1);
							},
							maskCallback: function () {
								console.log(2);
							}
						});
				})
				 //接种所在地
			    var area2 = new LArea();
					var provs_data=[];
				    ym.ajax({
				    	url: "/areaController/queryTree",
				    	success: function (data) {
				    		if(data.obj){
				    			provs_data=data.obj;		
				    		}
				    		area2.init({
				    				'trigger': '#address',
				    				'valueTo': '#addressHide',
				    				'keys': {
				    						id: 'id',
				    						name: 'name'
				    				},
				    				'type': 1,
				    				'data':provs_data,
                            });
                            var data={};
                            area2.success=function(){
                                var provinceCode=localStorage.getItem('provinceCode');
                                var cityCode=localStorage.getItem('cityCode');
                                var countyCode=localStorage.getItem('countyCode');
                                addr=address.value;
                                if(countyCode!=='null'){
                                    data={ countyAreaId:countyCode };
                                }else if(countyCode==='null'&&cityCode!=='null'){
                                    data={ cityAreaId:cityCode };
                                }else{
                                    data={ provinceAreaId:provinceCode };
                                }
                                /*查询地级市下面的接种点*/
                                ym.ajax({
                                    url: "/areaController/getStationDto",
                                    param:data,
                                    async:false,
                                    success: function (data) {
                                        if(data.obj){
                                            place=[];
                                            for (var i = 0; i < data.obj.length; i++) {
                                                place.push({id:data.obj[i].station_id,value:data.obj[i].station_name});
                                            }
                                        }
                                    }
                                });
                            }

				    	}
				    })
<<<<<<< .mine
				   var address=document.querySelector('#address');

||||||| .r28564
				   var address=document.querySelector('#address');
				   var data={};
				   address.addEventListener('blur', function () {
				   		var provinceCode=localStorage.getItem('provinceCode');
					   	var cityCode=localStorage.getItem('cityCode');
				    	var countyCode=localStorage.getItem('countyCode');
				    	addr=address.value;
				    	if(countyCode!=='null'){
				    		data={ countyAreaId:countyCode };
				    	}else if(countyCode==='null'&&cityCode!=='null'){
				    		data={ cityAreaId:cityCode };
				    	}else{
				    		data={ provinceAreaId:provinceCode };
				    	}
				   
				/*查询地级市下面的接种点*/
				    	ym.ajax({
				            url: "/areaController/getStationDto",
				            param:data,
				            success: function (data) {
				            	if(data.obj){
				               		place=[];
				               		for (var i = 0; i < data.obj.length; i++) {
				               			place.push({id:data.obj[i].station_id,value:data.obj[i].station_name});
				               		}
				               }
				            }
				        });
				    });
=======
>>>>>>> .r28612
			    //接种点
			    var showDomplace = document.querySelector('#place');
			    showDomplace.addEventListener('click', function () {
			    var bankSelect = new IosSelect(1,
			            [place],
			            {
			                container: '.container',
			                title: '接种地点',
                            showLoading:true,
			                callback: function (selectOneObj) {
			                    $("#place").val(selectOneObj.value);
			                    jzAddr=selectOneObj.id;
			                },
			                fallback: function () {
			                    console.log(1);
			                },
			                maskCallback: function () {
			                    console.log(2);
			                }
			        });
			    });
				/*添加疫苗记录*/
				$('#mendb').click(function(){
					
					var dataJson={
			                childId:childData.childId,
			                vaccineId:vaccineId,
			                agent:agent,
			                vaccinationTime:$('#vaccineDate').val(),
			                vaccineCard:childData.childCode,
			                stationId:jzAddr
			            };
			            
					 ym.ajax({
			            url: "/vaccine/insertYmChildrenOrderVaccinationSer",
			            param:dataJson,
			            success: function (data) {
			               if(data.obj==1){
			               		$("#ceng").modal('open');
					   			$('#info-text').html('添加成功');
								setTimeout(function(){ $("#ceng").modal('close');},800);
								window.location.href='jiezhongjilu.html';
			               }else{
			               		$("#ceng").modal('open');
					   			$('#info-text').html('添加失败');
								setTimeout(function(){ $("#ceng").modal('close');},800);
			               }
			            }
			        });
				})
			})
		</script>
	</body>
</html>
